//
//  ViewController.m
//  LayoutSizeClasses
//
//  Created by dllo on 15/11/17.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
//    NSLayoutConstraint 布局约束
//    
//    NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:<#(nonnull id)#> attribute:<#(NSLayoutAttribute)#> relatedBy:<#(NSLayoutRelation)#> toItem:<#(nullable id)#> attribute:<#(NSLayoutAttribute)#> multiplier:<#(CGFloat)#> constant:<#(CGFloat)#>]
    
    // 参数说明
    //
   
    
    UIView *view1 = [[UIView alloc] init];
    view1.backgroundColor = [UIColor redColor];
    //为了不和autosizing冲突，我们设置No
    [view1 setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:view1];
    
    UIView *view2 = [[UIView alloc] init];
    view2.backgroundColor = [UIColor redColor];
    //为了不和autosizing冲突，我们设置No
    [view1 setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:view2];
    
    
    UIView *view3 = [[UIView alloc] init];
    view3.backgroundColor = [UIColor redColor];
    //为了不和autosizing冲突，我们设置No
    [view3 setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:view3];
    
    UIView *view4 = [[UIView alloc] init];
    view4.backgroundColor = [UIColor redColor];
    //为了不和autosizing冲突，我们设置No
    [view4 setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:view4];
    
    
    // view1
    
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1 constant:+20]];
    
  
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
